 var id = getvl("id");
    $(function(){
    	  if(id!=''){
    	  	selectcaigou();
    	  }else{
    	  	  $("em").hide();
    	  	$(function () {
       $('.cgs_xuanze li').on('click',function(){
            //给菜单添加选择样式
            $(this).addClass('cgs_xuanze_li').siblings().removeClass('cgs_xuanze_li');
   
       });
    });
    	  }
    });
 //查询
 function selectcaigou(){
	     $.ajax({
            url: urlcore + "/api/bullInfo/selectbull?userId="+id,
			type: "get",
			dataType: 'json',
			contentType: "application/json;charset=utf-8",
			success: function(data) {
				if(data.success == true) {
					if(data.data!=null && data.data!=''){
						   var da=data.data;
						   if(da.status==1){
						   	  $("#dibu").html("");	
						   	$(".p_dizhi").html("已认证");
						   }else if(da.status==2){
						   	var shibai='<div class="mid-width" onclick="xiugais('+da.id+')">'+
    '<input type="button" class="p_button" value="重新认证">'+
    '</div>';
						   	  $("#dibu").html(shibai);	
						   	   $("em").hide();
    	  	$(function () {
       $('.cgs_xuanze li').on('click',function(){
            //给菜单添加选择样式
            $(this).addClass('cgs_xuanze_li').siblings().removeClass('cgs_xuanze_li');
   
       });
    });
    
						   		$(".p_dizhi").html("已失败");
						   }else if(da.status==0){
						   	  $("#dibu").html("");	
						   	$(".p_dizhi").html("认证中");
						   }
						   
						   if(da.bullType==1){
						   	$("#s1").attr("class","cgs_xuanze_li");
						     $("#s2").attr("class","");
						   }else{
						   	 	$("#s2").attr("class","cgs_xuanze_li");
						     $("#s1").attr("class","");
						   }
						   $("input").hide();
						    $("input").attr("disabled",true);  
						   $(".userName").text(da.userName);
						    $(".phone").text(da.phone);
						     $(".telephone").text(da.telephone);
						      $(".companyName").text(da.companyName);
						      $(".companyAddress").text(da.companyAddress);
						     
						      if(da.cardUrlFace!=null){
						      
						      	 $("#fengmian3").val(da.cardUrlFace);
						      	   $("#imghead3").attr("src",da.cardUrlFace);
						      }
						      if(da.cardUrlCon!=null){
						      	 $("#fengmian4").val(da.cardUrlCon);
						      	$("#imghead4").attr("src",da.cardUrlCon);
						      }
						      if(da.qualificationUrlFace!=null){
						      	$("#fengmian5").val(da.qualificationUrlFace);
						      	$("#imghead5").attr("src",da.qualificationUrlFace);
						      }
						      if(da.qualificationUrlCon!=null){
						      		$("#fengmian6").val(da.qualificationUrlCon);
						      	$("#imghead6").attr("src",da.qualificationUrlCon);
						      }			
						      
						     $("#shilitu1").html(""); 
						     $("#shilitu2").html(""); 
						     
						   /*   var dibu='<div class="mid-width" onclick="xiugai()">'+
                      '<input type="button" class="p_button" value="修改">'+
                                 '</div>';
					      $("#dibu").append(dibu);	      */
					}else{
						
    	  	  $("em").hide();
    	  	$(function () {
       $('.cgs_xuanze li').on('click',function(){
            //给菜单添加选择样式
            $(this).addClass('cgs_xuanze_li').siblings().removeClass('cgs_xuanze_li');
   
       });
    });
					}
					
				} else if(data.code == 'OVERTIME') {
					var thisUrl = window.location.href;
					alert(thisUrl);
					if(thisUrl.indexOf('1.0.0denglu.html') <= -1) {
						top.window.location.href = "1.0.0denglu.html";
					}
				} else {
					if(data.msg != '空数据') {
						alert(data.msg)
					} else {
						$('#thiscount').text(0);
					}
				}
			},
			error: function() {
				alert("error");
			}
		});
 }
 
 
 
 
 function xiugais(tes){
 	//alert(id);
 	var bull = "";
 	var bullType = $("#bullType").find("li"); //采购类型
 	$.each(bullType, function(y, n) {
 		if($(this).attr("class") == "cgs_xuanze_li") {
 			if($(this).html() == "网络品牌店") {
 				bull = 1;
 			} else if($(this).html() == "网络连锁店") {
 				bull = 2;
 			}
 		}
 	});
 	var userName = $("#userName").val(); //用户名
 	var cardUrlFace=$("#fengmian3").val();//正
 	var cardUrlCon=$("#fengmian4").val();//正
 	var qualificationUrlFace=$("#fengmian5").val();//正
 	var qualificationUrlCon=$("#fengmian6").val();
 	var phone = $("#phone").val(); //手机hao  
 	var telephone = $("#telephone").val(); //固定号码
 	var companyName = $("#companyName").val(); //公司名称
 	var companyAddress = $("#companyAddress").val(); //公司网站
 	//  var  shezhimorendizhi=$("#checkbox-1-1");//是否设置为默认地址
 	$.ajax({
 		url: urlcore + "/api/bullInfo/update",
 		type: "post",
 		contentType: "application/json;charset=utf-8",
 		data: JSON.stringify({
 			"id":tes,
 			"userId": id,
 			"cardUrlFace":cardUrlFace,
 			"cardUrlCon":cardUrlCon,
 			"qualificationUrlFace":qualificationUrlFace,
 			"qualificationUrlCon":qualificationUrlCon,
 			"bullType": bull,
 			"userName": userName,
 			"phone": phone,
 			"telephone":telephone,
 			"companyName": companyName,
 			"companyAddress": companyAddress,
 			"status":0
 		}),
 		dataType: "json",
 		success: function(data) {
 			if(data.success == true) {
 				alert("等待审核");
 				var ass=window.location.href;
 				window.location.href=ass;
 			}
 		},
 		error: function() {
 			alert("error");
 		}
 	});

 
 	
 }
 
 
 
 
 
 
 
 
 
 
 function tianjia() {
 	//alert(id);
 	var bull = "";
 	var bullType = $("#bullType").find("li"); //采购类型
 	$.each(bullType, function(y, n) {
 		if($(this).attr("class") == "cgs_xuanze_li") {
 			if($(this).html() == "网络品牌店") {
 				bull = 1;
 			} else if($(this).html() == "网络连锁店") {
 				bull = 2;
 			}
 		}
 	});
 	
 	var userName = $("#userName").val(); //用户名
 	var cardUrlFace=$("#fengmian3").val();//正
 	var cardUrlCon=$("#fengmian4").val();//正
 	var qualificationUrlFace=$("#fengmian5").val();//正
 	var qualificationUrlCon=$("#fengmian6").val();
 	var phone = $("#phone").val(); //手机hao  
 	var telephone = $("#telephone").val(); //固定号码
 	var companyName = $("#companyName").val(); //公司名称
 	var companyAddress = $("#companyAddress").val(); //公司网站
 	//  var  shezhimorendizhi=$("#checkbox-1-1");//是否设置为默认地址
 	$.ajax({
 		url: urlcore + "/api/bullInfo/add2",
 		type: "post",
 		contentType: "application/json;charset=utf-8",
 		data: JSON.stringify({
 			"userId": id,
 			"cardUrlFace":cardUrlFace,
 			"cardUrlCon":cardUrlCon,
 			"qualificationUrlFace":qualificationUrlFace,
 			"qualificationUrlCon":qualificationUrlCon,
 			"bullType": bull,
 			"userName": userName,
 			"phone": phone,
 			"telephone":telephone,
 			"companyName": companyName,
 			"companyAddress": companyAddress
 		}),
 		dataType: "json",
 		success: function(data) {
 			if(data.success == true) {
 				window.location.reload();
 			}
 		},
 		error: function() {
 			alert("error");
 		}
 	});

 }